<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" 
    prefix="c" %> 
<%@ page import="java.util.*, examples.webstore.domainobject.Product"%> 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Catalog</title>
</head>
<body>
<center>
<h1>Web Store</h1>
</center>
<table width="100%">
	<tr width="100%" align="right">
		<td align = "right"> 
		<c:url value="examples.webstore.service.LoginService.logout.invoke" var="logout" />
		 <a href= "${logout}"> logout </a>
		</td>
	</tr>
</table>
<h3>Catalog </h3>
<table border="1">
<tr> 
<th>Name</th>
<th><b>Price</th>
<th><b>Description</th>
<th>Details</th>
</tr>
<c:forEach var="product" items="${productList}">
<tr>
<td>${product.name}</td>
<td>${product.productDescription}</td>
<td>${product.price}</td>
<td><c:url value="examples.webstore.service.ProductService.showDetails.invoke" var="detailURL">
    <c:param name="name" value="${product.name}"/>
  </c:url>
  <a href= "${detailURL}"> details </a>
 </td>
</tr>
</c:forEach> 
<tr></tr>
<tr>
	<td colspan="3">
		<c:url value="examples.webstore.service.ProductService.showAll.invoke" var="showAll" />
		<a href= "${showAll}"> Show All </a></td>
	</td>
	<td>
		<a href= "/WebStore/addProduct.jsp"> Add </a></td>
	</tr>
</table>
</body>
</html>